package com.lanyun.aicorrectassistant.controller.admin.common;


import com.lanyun.aicorrectassistant.basic.bean.Result;
import com.lanyun.aicorrectassistant.handler.StorageService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: Jqchan_
 */
@RequestMapping("/api-admin/file")
@RestController
public class FileUploadController {

    @Resource
    private StorageService storageService;

    @PostMapping("/upload")
    public Result upload(@RequestParam("file") MultipartFile file) {
        String filePath = storageService.uploadFile(file);
        return Result.success(filePath);
    }

}
